package com.test.pudamoney.bean_pudamoney.process_pudamoney;

import com.test.pudamoney.util_pudamoney.StringUtil_pudamoney;
import com.google.gson.Gson;
import com.google.gson.JsonArray;

import java.util.ArrayList;

public class ProcessStep_pudamoney {

    private ProcessStep_pudamoney(){}

    private String apiUrl;
    private JsonArray dataList;
    private JsonArray extDataList;
    private String showTopTips;
    private String itemCount;
    private String isContact;
    private String contactParamName;
    private ArrayList<ArrayList<String>> relationShips;


    public String getApiUrl() {
        return StringUtil_pudamoney.getSafeString(apiUrl);
    }

    public boolean showTopTips(){
        return StringUtil_pudamoney.getSafeString(showTopTips).equalsIgnoreCase("YES");
    }

    public int getDataListSize(){
        if (dataList==null) return 0;
        return dataList.size();
    }

    public ProcessData_pudamoney getProcessData(int index){
        if (index<0||index>=dataList.size()) return null;
        return new Gson().fromJson(dataList.get(index).toString(), ProcessData_pudamoney.class);
    }

    public int getExtDataListSize(){
        if (extDataList == null) return 0;
        return extDataList.size();
    }

    public ProcessData_pudamoney getExtProcessData(int index){
        if (index<0||index>=extDataList.size()) return null;
        return new Gson().fromJson(extDataList.get(index).toString(), ProcessData_pudamoney.class);
    }

    public int getItemCount() {
        return StringUtil_pudamoney.safeParseInt(itemCount);
    }

    public boolean isContact() {
        return StringUtil_pudamoney.getSafeString(isContact).equalsIgnoreCase("YES");
    }

    public String getContactParamName() {
        return StringUtil_pudamoney.getSafeString(contactParamName);
    }

    public ArrayList<String> getRelationShips(int index) {
        if (relationShips==null||relationShips.size()<=index) return new ArrayList<>();
        return relationShips.get(index);
    }

}
